 $(function(){

 	var oldPassword;
 	var newPassword;
 	var surePassword;
 	//修改弹出模态框
 	$("#sureUpdate").click(function(){
 		newPassword=$("#newPassword").val();
 		surePassword=$("#surePassword").val();
 		oldPassword=$("#oldPassword").val();
 		if(oldPassword==""){
 			myTool.alert({		
 				title:"提示",
 				context:"旧密码不能为空！",
 				isMask:true,
 				callback:function(){}
 			});
 		}else if(newPassword==""||surePassword==""){
 			myTool.alert({		
 				title:"提示",
 				context:"新密码和确认密码不能为空！",
 				isMask:true,
 				callback:function(){}
 			});
 		}else if(newPassword!=surePassword)
 		{
 			myTool.alert({		
 				title:"提示",
 				context:"新密码和确认密码不相同！",
 				isMask:true,
 				callback:function(){}
 			});
 		}
 		else if(newPassword.length<6||newPassword.length>16)
 		{
 			
 			myTool.alert({		
 				title:"提示",
 				context:"密码长度必须为6~16位。",
 				isMask:true,
 				callback:function(){}
 			});
 		}else{
 			myTool.alert({		
 				title:"修改密码",
 				context:"是否确认修改密码?",
 				isMask:true,
 				callback:function(){
 					modifyPassword();
 				}
 			});
 		}
 	})
 	//模态框确定按钮
 	
 	function modifyPassword()
 	{
 		var url="userMoidfyPassword.do";//获取用户信息
 		var password={oldPassword:oldPassword,newPassword:newPassword};
 		YuXi.util.get(url,password,function(data){
 			
 				myTool.alert({		
 	 				title:"修改提示",
 	 				context:data.msg,
 	 				isMask:true,
 	 				callback:function(){
 	 				}
 	 			});
 		},function(){
 			
 		})
 	}

 })